<template>
  <div class='my-menu'>
    <el-menu :default-active="activeIndex" @select="handleSelect" class="el-menu-vertical-demo" :background-color="colorInfo.bgc" :text-color="colorInfo.txtc" :active-text-color="colorInfo.acttxt">
      <el-menu-item v-for="(item,index) in menuData" :key="index" :index="item.route">
        <i :class="item.logo"></i>
        <span slot="title">{{item.label}}</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>
<script>
export default {
  components: {},
  name: "",
  data() {
    return {
      activeIndex: "/",
      colorInfo:{
        bgc:"#fff",
        txtc:"#333",
        acttxt:"#fff"
      },
      menuData: [
        {logo:"iconfont icon-gongzuotai",label:"工作台",route:"/works",children:[/* {label:"",route:""} */]},
        {logo:"iconfont icon-index",label:"主页管理",route:"/manageHome",children:[]},
        {logo:"iconfont icon-wenjian",label:"议题管理",route:"/manageIssues",children:[]},
        {logo:"iconfont icon-APP_KMIA_GRADE",label:"议题评分管理",route:"/manageIssuesGrages",children:[]},
        {logo:"iconfont icon-toupiao",label:"部门投票管理",route:"/manageDeparts",children:[]},
        {logo:"iconfont icon-danmu",label:"弹幕管理",route:"/manageBarrage",children:[]},
        {logo:"iconfont icon-gerenzhongxin-xuanzhong",label:"会员角色管理",route:"/manageRoles",children:[]},
        {logo:"iconfont icon-choucha",label:"会议管理",route:"/manageMeetings",children:[]},
        {logo:"iconfont icon-jiangbei",label:"答题闯关",route:"/questions",children:[]},
      ]
    };
  },
  methods: {
    handleSelect(index) {
      this.$router.push(index)
    },

    setSelected(){
      var path = _g.getRouterPath(this)
      this.menuData.forEach(ele=>{
        if(path.indexOf(ele.route)>-1){
          this.activeIndex=ele.route
          return
        }
      })
    }
  },
  created() {
    this.setSelected()
  }
};
</script>
<style lang="scss" scoped>

</style>